﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Region.Forms
{
    public partial class MainForm : Form
    {
        Engine m_engine;
        public MainForm(Engine engine)
        {
            m_engine = engine;
            InitializeComponent();
            Text = Text + " " + Application.ProductVersion;
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Form F = new RegionRasporListForm(m_engine);
            this.Visible = false;
            F.ShowDialog();
            F = null;
            this.Visible = true;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            var F = new Forms.RegionKontList(m_engine);
            this.Visible = false;
            F.ShowDialog();
            F = null;
            this.Visible = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {            
            var Import = new Forms.ImportEgrip(m_engine);
            this.Visible = false;
            Import.ShowDialog();
            if (Import.KontID > 0)
            {
                KontForm KF = new KontForm(m_engine, Import.KontID);
                KF.ShowDialog();                
            }
            this.Visible = true;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            RasporForm RF = new RasporForm(m_engine, m_engine.newRaspor(0));
            this.Visible = false;
            RF.ShowDialog();
            this.Visible = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void button6_Click(object sender, EventArgs e)
        {
            RegionRasporListForm F = new RegionRasporListForm(m_engine);
            this.Visible = false;
            F.NoPodpis = true;
            F.ShowReestr(F, null);
            F.ShowDialog();                        
            F = null;
            this.Visible = true;
        }

        private void flowLayoutPanel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void button7_Click(object sender, EventArgs e)
        {
            Form F = new ProcurorListForm(m_engine);
            this.Visible = false;
            F.ShowDialog();
            F = null;
            this.Visible = true;
        }

        private void button8_Click(object sender, EventArgs e)
        {
            ProcurorForm F = new ProcurorForm(m_engine, m_engine.newProcuror(0));
            this.Visible = false;
            F.ShowDialog();
            this.Visible = true;
        }
    }
}
